import rxAjax from '@/assets/js/ajax.js';

//应用授权表 api接口
export const SysAppAuthApi = {};

SysAppAuthApi.baseUrl= '/api-system/system/core/sysAppAuth';
SysAppAuthApi.exportUrl= SysAppAuthApi.baseUrl + '/listExport';

//查询列表
SysAppAuthApi.query=function (parameter) {
  var url= SysAppAuthApi.baseUrl + '/query';
  return rxAjax.postJson(url,parameter).then (res => {
    return res.result
  })
}

/**
* 获取单记录
* @param pkId
* @returns {*}
*/
SysAppAuthApi.get =function(pkId) {
  var url= SysAppAuthApi.baseUrl + '/get?pkId=' + pkId;
  return rxAjax.get(url);
}

//保存数据
SysAppAuthApi.save =function(parameter) {
  var url= SysAppAuthApi.baseUrl + '/save';
  return rxAjax.postJson(url,parameter);
}

//删除数据
SysAppAuthApi.del =function(parameter) {
  var url= SysAppAuthApi.baseUrl + '/del';
  return rxAjax.postUrl(url,parameter);
}

SysAppAuthApi.findListByAppId=function(appId){
  var url = SysAppAuthApi.baseUrl + '/findListByAppId?appId='+appId;
  return rxAjax.get(url);
}

//批量保存授权
SysAppAuthApi.saveSysAppAuth=function(parameter,pkId){
  var url = SysAppAuthApi.baseUrl + '/saveSysAppAuth?pkId='+pkId;
  return rxAjax.postJson(url,parameter);
}

export  default SysAppAuthApi;

